import { request } from "./request";
// group
// 获得分组列表
export function getGroup(offset: string, count: string) {
    return request({
        url: '/group/all',
        method: 'get',
        params: {
            offset,
            count
        }
    })
}
// 分组所属设备
export function getGroupMechanism(id: string) {
    return request({
        url: '/group/devices/' + id,
        method: 'get',
    })
}
// 添加分组
export function addGroup(name: string, describe: string, devices: any) {
    return request({
        url: '/group',
        method: 'post',
        data: {
            name,
            describe,
            devices
        }
    })
}
// 删除分组
export function deleteGroup(id: string) {
    return request({
        url: '/group/' + id,
        method: 'delete',
    })
}


// device
// 获得设备列表
export function getMechanism(offset: string, count: string) {
    return request({
        url: '/device/all',
        method: 'get',
        params: {
            offset,
            count
        }
    })
}
// 添加设备
export function addMechanism(name: string, mac: string) {
    return request({
        url: '/device',
        method: 'post',
        data: {
            name,
            mac
        }
    })
}
// 删除设备
export function deleteMechanism(id: string) {
    return request({
        url: '/device/' + id,
        method: 'delete',
    })
}
// 设备详情
export function infoMechanism(id: string) {
    return request({
        url: '/device/info/' + id,
        method: 'get',
    })
}
